/*********************************
 * PROPRIETARY/CONFIDENTIAL.  Use of this product is subject to license terms.
 * Copyright (c) 2012 NVision Group, Inc. All rights reserved.
 *
 * GwtpUtil.java 03.10.2012 1:15:38
 *********************************/
package ru.kruzhki.client.gwtp;

import com.google.inject.Inject;
import com.gwtplatform.mvp.client.proxy.PlaceManager;

/**
 * @author serg
 *
 */
public final class GwtpUtil {
	private final PlaceManager placeManager;
	private static GwtpUtil INSTANCE;
	@Inject
	public GwtpUtil(PlaceManager placeManager) {
		if(INSTANCE!=null){
			throw new IllegalStateException("Cannot create another instance of GwtpUtil because it is singleton.");
		}
		this.placeManager = placeManager;
		INSTANCE=this;
	}
	
	public static <E extends Enum<E>> String getParam(E param){
		return INSTANCE.placeManager.getCurrentPlaceRequest().getParameter(param.name().toLowerCase(), null);
	}
	
}
